package com.ylzinfo.jck.controller;

import com.ylzinfo.jck.domain.Ac01;
import com.ylzinfo.jck.service.Ac01Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author sunqy
 * @create 2019/12/31
 */
@Controller
@RequestMapping("/person")
public class PersonController {

    @Autowired
    private Ac01Service ac01Service;

    @ResponseBody
    @RequestMapping("/query")
    public String query(){
        Ac01 ac01 = ac01Service.findAc01ByAac002("370828198106025610");
        return ac01.getAac003();
    }


    @GetMapping("/{aac002}")
    @ResponseBody
    public Object query(@PathVariable String aac002){
        return ac01Service.findAc01ByAac002(aac002);
    }

    @GetMapping("/init")
    @ResponseBody
    public String init(){
        try {
            return ac01Service.init();
        } catch (Exception e) {
            e.printStackTrace();
            return "初始化异常";
        }
    }
}
